/***************************************************************************
 *   Copyright (C) 2009 by umbacos@gmail.com                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef _UDM_COMMON
#define _UDM_COMMON

#define DEBUG
#define LOGFILE "/tmp/udm.log"

#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#include <getopt.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <sys/vfs.h>
#include <sys/statvfs.h>
#include <grp.h>
#include <dirent.h>
#include <syslog.h>
#include <locale.h>
#include <ftw.h>

#define STDIN	0
#define STDOUT  1
#define STDERR	2


#define TRUE  -1
#define FALSE 0
#define NONE  1

#define PRE_FORM  "FORM_"
#define PRE_COOKIE  "COOKIE_"
#define PRE_TORRENT  " -P "

#define D_WWW  "www/udm/"
#define D_UFB  "/udmfb/"
#define D_BIN  "bin/"
#define D_DNL  "dnl/"
#define D_TRK  "trk/"
#define D_CGI  "cgi-bin/"
#define F_CNF  "udm.conf"
#define S_CNF  "servers.conf"
#define TMP_CNF "/tmp/udm.conf"
#define PID_FILE "udm.pid"

#define CMD_MEGAUPLOAD "mu"
#define CMD_FB       "fb"
#define CMD_AMULE    "amule"
#define CMD_AMURE    "amure"
#define CMD_TAR      "targz"
#define CMD_TREE     "tree"
#define CMD_SVRS     "serv"
#define CMD_WGET     "wget"
#define CMD_UPLOAD   "upload"
#define CMD_DISK     "disk"
#define CMD_STARTDNL "startdnl"
#define CMD_STARTTOR "starttor"
#define CMD_WGET     "wget"
#define CMD_CTOR     "ctor"
#define CMD_STOP     "stop"
#define CMD_META     "meta"
#define CMD_RENAME   "rename"
#define CMD_STATUS   "status"
#define CMD_DELETE   "del"
#define CMD_NUKEALL  "nukeall"
#define CMD_REMOVE   "rem"
#define CMD_DOWNLOAD "dow"
#define CMD_MEDIATOMB "mediatomb"
#define CMD_COPY     "copy"
#define CMD_MKDIR    "mkdir"
#define CMD_RUN      "run"
#define CMD_LOCK     "lock"
#define CMD_SCRIPTS  "scripts"

#define CMD_TRANS_GET_SESSION	"getsex"
#define CMD_TRANS_PROXY 		"proxy"
#define CMD_TRANS_RSETTINGS 	"t-read"

#define FILTER_TOR   ".tor"
#define FILTER_WGT   ".wgt"
#define FILTER_INF   ".nfo"
#define FILTER_AMU   ".amu"

char* dcgi;
char* droo;
char* dbin;
char* wget;
char* ctor;
char* mtomb_start;
char* mtomb_stop;
char* dwww;
char* ddnl;
char* dtrk;
char* fcnf;
char* pCtor;
char* pWget;
char* argv0;
char* filter;
char* pidfile;

void * xmalloc ( size_t size );

#endif
